<?php
class Equipment_model extends DS_Model{
    private $model;
    function __construct(){
        parent::__construct();
        $this->load->helpers('string_helper');
        $this->model='equipment';
    }

    //根据条件查询一条信息
    public function onceInfo($where,$select){
        $res=$this->db->where($where)->select($select)->order_by('id desc')->limit(1)->get($this->model)->row_array();
        return $res;
    }
    //查询总的条数
    public function countLog($where){
        $count=$this->db->where($where)->from($this->model)->count_all_results();
        return $count;
    }
    //添加
    public function insertInfo($data){
        $res=$this->db->insert($this->model,$data);
        return $res;
    }
    //修改  
    public function updateInfo($data,$where){
        $res=$this->db->update($this->model,$data,$where);
        return $res;
    }
    public function getInfo($where){
        $res=$this->db->where(array('id'=>$where))->select("*")->order_by('id desc')->limit(1)->get($this->model)->row_array();
        return $res;
    }
    //根据条件查询所有信息
    public function allInfoorder($where,$select,$order_by){
        $res=$this->db->where($where)->select($select)->order_by($order_by)->get($this->model)->result_array();
        return $res;
    }


}